Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com> ...
authorOwen Taylor <otaylor@src.gnome.org>
Thu, 16 May 2002 23:38:01 +0000 (23:38 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Thu, 16 May 2002 23:38:01 +0000 (23:38 +0000)
ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkplug.c
gtk/gtksocket.c
gtk/gtkwindow.c

index eafda3c023b69eaca09bbdc4775c36cdba645460..db3da96bb69a1ccd45368c2032ccb2a732c2f511 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+ Thu May 16 18:47:29 2002  Owen Taylor  <otaylor@redhat.com>
+       * gtk/gtkwindow.c (gtk_window_show): Disable the
+       focus-some-widget code for GtkPlug descendants.
+       * gtk/gtkplug.c (gtk_plug_focus_event): Eat 
+       focus-in/out events since they can be generated
+       by keyboard grabs, but are spurious for an embeddded
+       widget. (#79196, Padraig O'Briain)
+       * gtk/gtksocket.c (gtk_socket_size_request): Only
+       pay attention to the minimum size hints, and changes
+       to that ... ignore the default size.
+       * gtk/gtksocket.c (gtk_socket_send_configure_event):
+       Pass in root-window relative coordinates as per
+       the ICCCM.
+       * gtk/gtksocket.c (gtk_socket_size_allocate): Send
+       as many synthetic configures as necessary to make
+       up for ConfigureRequest events we got. (#78799,
+       Dave Camp.)
+
 Thu May 16 23:59:56 2002  Kristian Rietveld  <kris@gtk.org>
 
        Merged from gtk-2-0.
index eafda3c023b69eaca09bbdc4775c36cdba645460..db3da96bb69a1ccd45368c2032ccb2a732c2f511 100644 (file)
@@ -1,3 +1,26 @@
+ Thu May 16 18:47:29 2002  Owen Taylor  <otaylor@redhat.com>
+       * gtk/gtkwindow.c (gtk_window_show): Disable the
+       focus-some-widget code for GtkPlug descendants.
+       * gtk/gtkplug.c (gtk_plug_focus_event): Eat 
+       focus-in/out events since they can be generated
+       by keyboard grabs, but are spurious for an embeddded
+       widget. (#79196, Padraig O'Briain)
+       * gtk/gtksocket.c (gtk_socket_size_request): Only
+       pay attention to the minimum size hints, and changes
+       to that ... ignore the default size.
+       * gtk/gtksocket.c (gtk_socket_send_configure_event):
+       Pass in root-window relative coordinates as per
+       the ICCCM.
+       * gtk/gtksocket.c (gtk_socket_size_allocate): Send
+       as many synthetic configures as necessary to make
+       up for ConfigureRequest events we got. (#78799,
+       Dave Camp.)
+
 Thu May 16 23:59:56 2002  Kristian Rietveld  <kris@gtk.org>
 
        Merged from gtk-2-0.
index eafda3c023b69eaca09bbdc4775c36cdba645460..db3da96bb69a1ccd45368c2032ccb2a732c2f511 100644 (file)
@@ -1,3 +1,26 @@
+ Thu May 16 18:47:29 2002  Owen Taylor  <otaylor@redhat.com>
+       * gtk/gtkwindow.c (gtk_window_show): Disable the
+       focus-some-widget code for GtkPlug descendants.
+       * gtk/gtkplug.c (gtk_plug_focus_event): Eat 
+       focus-in/out events since they can be generated
+       by keyboard grabs, but are spurious for an embeddded
+       widget. (#79196, Padraig O'Briain)
+       * gtk/gtksocket.c (gtk_socket_size_request): Only
+       pay attention to the minimum size hints, and changes
+       to that ... ignore the default size.
+       * gtk/gtksocket.c (gtk_socket_send_configure_event):
+       Pass in root-window relative coordinates as per
+       the ICCCM.
+       * gtk/gtksocket.c (gtk_socket_size_allocate): Send
+       as many synthetic configures as necessary to make
+       up for ConfigureRequest events we got. (#78799,
+       Dave Camp.)
+
 Thu May 16 23:59:56 2002  Kristian Rietveld  <kris@gtk.org>
 
        Merged from gtk-2-0.
index eafda3c023b69eaca09bbdc4775c36cdba645460..db3da96bb69a1ccd45368c2032ccb2a732c2f511 100644 (file)
@@ -1,3 +1,26 @@
+ Thu May 16 18:47:29 2002  Owen Taylor  <otaylor@redhat.com>
+       * gtk/gtkwindow.c (gtk_window_show): Disable the
+       focus-some-widget code for GtkPlug descendants.
+       * gtk/gtkplug.c (gtk_plug_focus_event): Eat 
+       focus-in/out events since they can be generated
+       by keyboard grabs, but are spurious for an embeddded
+       widget. (#79196, Padraig O'Briain)
+       * gtk/gtksocket.c (gtk_socket_size_request): Only
+       pay attention to the minimum size hints, and changes
+       to that ... ignore the default size.
+       * gtk/gtksocket.c (gtk_socket_send_configure_event):
+       Pass in root-window relative coordinates as per
+       the ICCCM.
+       * gtk/gtksocket.c (gtk_socket_size_allocate): Send
+       as many synthetic configures as necessary to make
+       up for ConfigureRequest events we got. (#78799,
+       Dave Camp.)
+
 Thu May 16 23:59:56 2002  Kristian Rietveld  <kris@gtk.org>
 
        Merged from gtk-2-0.
index eafda3c023b69eaca09bbdc4775c36cdba645460..db3da96bb69a1ccd45368c2032ccb2a732c2f511 100644 (file)
@@ -1,3 +1,26 @@
+ Thu May 16 18:47:29 2002  Owen Taylor  <otaylor@redhat.com>
+       * gtk/gtkwindow.c (gtk_window_show): Disable the
+       focus-some-widget code for GtkPlug descendants.
+       * gtk/gtkplug.c (gtk_plug_focus_event): Eat 
+       focus-in/out events since they can be generated
+       by keyboard grabs, but are spurious for an embeddded
+       widget. (#79196, Padraig O'Briain)
+       * gtk/gtksocket.c (gtk_socket_size_request): Only
+       pay attention to the minimum size hints, and changes
+       to that ... ignore the default size.
+       * gtk/gtksocket.c (gtk_socket_send_configure_event):
+       Pass in root-window relative coordinates as per
+       the ICCCM.
+       * gtk/gtksocket.c (gtk_socket_size_allocate): Send
+       as many synthetic configures as necessary to make
+       up for ConfigureRequest events we got. (#78799,
+       Dave Camp.)
+
 Thu May 16 23:59:56 2002  Kristian Rietveld  <kris@gtk.org>
 
        Merged from gtk-2-0.
index eafda3c023b69eaca09bbdc4775c36cdba645460..db3da96bb69a1ccd45368c2032ccb2a732c2f511 100644 (file)
@@ -1,3 +1,26 @@
+ Thu May 16 18:47:29 2002  Owen Taylor  <otaylor@redhat.com>
+       * gtk/gtkwindow.c (gtk_window_show): Disable the
+       focus-some-widget code for GtkPlug descendants.
+       * gtk/gtkplug.c (gtk_plug_focus_event): Eat 
+       focus-in/out events since they can be generated
+       by keyboard grabs, but are spurious for an embeddded
+       widget. (#79196, Padraig O'Briain)
+       * gtk/gtksocket.c (gtk_socket_size_request): Only
+       pay attention to the minimum size hints, and changes
+       to that ... ignore the default size.
+       * gtk/gtksocket.c (gtk_socket_send_configure_event):
+       Pass in root-window relative coordinates as per
+       the ICCCM.
+       * gtk/gtksocket.c (gtk_socket_size_allocate): Send
+       as many synthetic configures as necessary to make
+       up for ConfigureRequest events we got. (#78799,
+       Dave Camp.)
+
 Thu May 16 23:59:56 2002  Kristian Rietveld  <kris@gtk.org>
 
        Merged from gtk-2-0.
index 18fc239d5276705cbdd4f738f1e79beb20f44195..918327a214dd308d3f8a9a0fcdfa144ae354bb5a 100644 (file)
@@ -48,6 +48,8 @@ static void            gtk_plug_size_allocate         (GtkWidget        *widget,
                                                       GtkAllocation    *allocation);
 static gboolean        gtk_plug_key_press_event       (GtkWidget        *widget,
                                                       GdkEventKey      *event);
+static gboolean        gtk_plug_focus_event           (GtkWidget        *widget,
+                                                      GdkEventFocus    *event);
 static void            gtk_plug_set_focus             (GtkWindow        *window,
                                                       GtkWidget        *focus);
 static gboolean        gtk_plug_focus                 (GtkWidget        *widget,
@@ -123,6 +125,8 @@ gtk_plug_class_init (GtkPlugClass *class)
   widget_class->realize = gtk_plug_realize;
   widget_class->unrealize = gtk_plug_unrealize;
   widget_class->key_press_event = gtk_plug_key_press_event;
+  widget_class->focus_in_event = gtk_plug_focus_event;
+  widget_class->focus_out_event = gtk_plug_focus_event;
 
   widget_class->show = gtk_plug_show;
   widget_class->hide = gtk_plug_hide;
@@ -653,6 +657,17 @@ gtk_plug_key_press_event (GtkWidget   *widget,
     return FALSE;
 }
 
+static gboolean
+gtk_plug_focus_event (GtkWidget      *widget,
+                     GdkEventFocus  *event)
+{
+  /* We eat focus-in events and focus-out events, since they
+   * can be generated by something like a keyboard grab on
+   * a child of the plug.
+   */
+  return FALSE;
+}
+
 static void
 gtk_plug_set_focus (GtkWindow *window,
                    GtkWidget *focus)
@@ -1028,15 +1043,24 @@ handle_xembed_message (GtkPlug   *plug,
       
     case XEMBED_FOCUS_OUT:
       {
+       GtkWidget *widget = GTK_WIDGET (plug);
        GdkEvent event;
 
        event.focus_change.type = GDK_FOCUS_CHANGE;
-       event.focus_change.window = GTK_WIDGET (plug)->window;
+       event.focus_change.window = widget->window;
        event.focus_change.send_event = TRUE;
-       event.focus_change.in = (message == XEMBED_FOCUS_IN);
-
-       gtk_widget_event (GTK_WIDGET (plug), &event);
 
+       if (message == XEMBED_FOCUS_IN)
+         {
+           event.focus_change.in = TRUE;
+           GTK_WIDGET_CLASS (parent_class)->focus_in_event (widget, (GdkEventFocus *)&event);
+         }
+       else
+         {
+           event.focus_change.in = FALSE;
+           GTK_WIDGET_CLASS (parent_class)->focus_out_event (widget, (GdkEventFocus *)&event);
+         }
+       
        break;
       }
       
index c0677132eda90aa57cf9141e8890293b0ed43264..14cfbd6c99266a7098d9914f5988e1f0cab518b2 100644 (file)
 
 #include "xembed.h"
 
+typedef struct _GtkSocketPrivate GtkSocketPrivate;
+
+struct _GtkSocketPrivate
+{
+  gint resize_count;
+};
+
 /* Forward declararations */
 
 static void     gtk_socket_class_init           (GtkSocketClass   *klass);
@@ -104,6 +111,27 @@ static guint socket_signals[LAST_SIGNAL] = { 0 };
 
 static GtkWidgetClass *parent_class = NULL;
 
+GtkSocketPrivate *
+gtk_socket_get_private (GtkSocket *socket)
+{
+  GtkSocketPrivate *private;
+  static GQuark private_quark = 0;
+
+  if (!private_quark)
+    private_quark = g_quark_from_static_string ("gtk-socket-private");
+
+  private = g_object_get_qdata (G_OBJECT (socket), private_quark);
+
+  if (!private)
+    {
+      private = g_new0 (GtkSocketPrivate, 1);
+      g_object_set_qdata_full (G_OBJECT (socket), private_quark,
+                              private, (GDestroyNotify) g_free);
+    }
+
+  return private;
+}
+
 GtkType
 gtk_socket_get_type (void)
 {
@@ -358,6 +386,7 @@ gtk_socket_realize (GtkWidget *widget)
 static void
 gtk_socket_end_embedding (GtkSocket *socket)
 {
+  GtkSocketPrivate *private = gtk_socket_get_private (socket);
   GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (socket));
   gint i;
   
@@ -367,6 +396,7 @@ gtk_socket_end_embedding (GtkSocket *socket)
 
   g_object_unref (socket->plug_window);
   socket->plug_window = NULL;
+  private->resize_count = 0;
 
   /* Remove from end to avoid indexes shifting. This is evil */
   for (i = socket->accel_group->n_accels - 1; i >= 0; i--)
@@ -414,19 +444,15 @@ gtk_socket_size_request (GtkWidget      *widget,
          long supplied;
          
          gdk_error_trap_push ();
+
+         socket->request_width = 1;
+         socket->request_height = 1;
          
          if (XGetWMNormalHints (GDK_WINDOW_XDISPLAY (socket->plug_window),
                                 GDK_WINDOW_XWINDOW (socket->plug_window),
                                 &hints, &supplied))
            {
-             /* This is obsolete, according the X docs, but many programs
-              * still use it */
-             if (hints.flags & (PSize | USSize))
-               {
-                 socket->request_width = hints.width;
-                 socket->request_height = hints.height;
-               }
-             else if (hints.flags & PMinSize)
+             if (hints.flags & PMinSize)
                {
                  socket->request_width = hints.min_width;
                  socket->request_height = hints.min_height;
@@ -437,7 +463,7 @@ gtk_socket_size_request (GtkWidget      *widget,
                  socket->request_height = hints.base_height;
                }
            }
-         socket->have_size = TRUE;     /* don't check again? */
+         socket->have_size = TRUE;
          
          gdk_error_trap_pop ();
        }
@@ -486,22 +512,19 @@ gtk_socket_size_allocate (GtkWidget     *widget,
        }
       else if (socket->plug_window)
        {
+         GtkSocketPrivate *private = gtk_socket_get_private (socket);
+         
          gdk_error_trap_push ();
          
-         if (!socket->need_map &&
-             (allocation->width == socket->current_width) &&
-             (allocation->height == socket->current_height))
-           {
-             gtk_socket_send_configure_event (socket);
-             GTK_NOTE(PLUGSOCKET, 
-                      g_message ("GtkSocket - allocated no change: %d %d",
-                                 allocation->width, allocation->height));
-           }
-         else
+         if (allocation->width != socket->current_width ||
+             allocation->height != socket->current_height)
            {
              gdk_window_move_resize (socket->plug_window,
                                      0, 0,
                                      allocation->width, allocation->height);
+             if (private->resize_count)
+               private->resize_count--;
+             
              GTK_NOTE(PLUGSOCKET,
                       g_message ("GtkSocket - allocated: %d %d",
                                  allocation->width, allocation->height));
@@ -515,6 +538,15 @@ gtk_socket_size_allocate (GtkWidget     *widget,
              socket->need_map = FALSE;
            }
 
+         while (private->resize_count)
+           {
+             gtk_socket_send_configure_event (socket);
+             private->resize_count--;
+             GTK_NOTE(PLUGSOCKET,
+                      g_message ("GtkSocket - sending synthetic configure: %d %d",
+                                 allocation->width, allocation->height));
+           }
+         
          gdk_display_sync (gtk_widget_get_display (widget));
          gdk_error_trap_pop ();
        }
@@ -934,6 +966,7 @@ static void
 gtk_socket_send_configure_event (GtkSocket *socket)
 {
   XEvent event;
+  gint x, y;
 
   g_return_if_fail (socket->plug_window != NULL);
 
@@ -942,8 +975,16 @@ gtk_socket_send_configure_event (GtkSocket *socket)
   event.xconfigure.event = GDK_WINDOW_XWINDOW (socket->plug_window);
   event.xconfigure.window = GDK_WINDOW_XWINDOW (socket->plug_window);
 
-  event.xconfigure.x = 0;
-  event.xconfigure.y = 0;
+  /* The ICCCM says that synthetic events should have root relative
+   * coordinates. We still aren't really ICCCM compliant, since
+   * we don't send events when the real toplevel is moved.
+   */
+  gdk_error_trap_push ();
+  gdk_window_get_origin (socket->plug_window, &x, &y);
+  gdk_error_trap_pop ();
+                        
+  event.xconfigure.x = x;
+  event.xconfigure.y = y;
   event.xconfigure.width = GTK_WIDGET(socket)->allocation.width;
   event.xconfigure.height = GTK_WIDGET(socket)->allocation.height;
 
@@ -1284,14 +1325,8 @@ gtk_socket_filter_func (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
 
            if (socket->plug_window)
              {
-               socket->request_width = xcwe->width;
-               socket->request_height = xcwe->height;
-               socket->have_size = TRUE;
-               
                GTK_NOTE(PLUGSOCKET,
-                        g_message ("GtkSocket - window created with size: %d %d",
-                                   socket->request_width,
-                                   socket->request_height));
+                        g_message ("GtkSocket - window created"));
              }
          }
        
@@ -1309,17 +1344,16 @@ gtk_socket_filter_func (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
        
        if (socket->plug_window)
          {
+           GtkSocketPrivate *private = gtk_socket_get_private (socket);
+           
            if (xcre->value_mask & (CWWidth | CWHeight))
              {
-               socket->request_width = xcre->width;
-               socket->request_height = xcre->height;
-               socket->have_size = TRUE;
-               
                GTK_NOTE(PLUGSOCKET,
                         g_message ("GtkSocket - configure request: %d %d",
                                    socket->request_width,
                                    socket->request_height));
-               
+
+               private->resize_count++;
                gtk_widget_queue_resize (widget);
              }
            else if (xcre->value_mask & (CWX | CWY))
@@ -1404,7 +1438,12 @@ gtk_socket_filter_func (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
        {
          GdkDragProtocol protocol;
 
-         if ((xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "XdndAware")) ||
+         if (xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "WM_NORMAL_HINTS"))
+           {
+             socket->have_size = FALSE;
+             gtk_widget_queue_resize (widget);
+           }
+         else if ((xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "XdndAware")) ||
              (xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "_MOTIF_DRAG_RECEIVER_INFO")))
            {
              gdk_error_trap_push ();
index c996d4ab5e357570836aae40d92f94352f8d62bb..e3c274a9856bc31a4b21559b5e3fb589429e59ce 100644 (file)
@@ -40,6 +40,7 @@
 #include "gtkiconfactory.h"
 #include "gtkintl.h"
 #include "gtkmarshalers.h"
+#include "gtkplug.h"
 
 enum {
   SET_FOCUS,
@@ -3137,7 +3138,7 @@ gtk_window_show (GtkWidget *widget)
 
   /* Try to make sure that we have some focused widget
    */
-  if (!window->focus_widget)
+  if (!window->focus_widget && !GTK_IS_PLUG (window))
     gtk_window_move_focus (window, GTK_DIR_TAB_FORWARD);
   
   if (window->modal)